package com.itheima.wemedia.fagin;

import com.itheima.common.vo.ResultVo;
import com.itheima.wemedia.dto.WmNewsDtoSave;
import com.itheima.wemedia.pojo.WmNews;
import com.itheima.wemedia.vo.WmNewsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(name = "leadnews-wemedia", contextId = "adWmNewsFeign")
public interface AdWmNewsFeign {
    /**
     * 查询文章id为8和定时发布时间小于当前时间的所有文章，封装为到wmNewsDtoSave中
     * @param wmNewsDtoSave 分片时可以接收参数，的接口
     * @return 返回查询到的结果进行封装
     */
    @PostMapping("/api/admin/WmNews")
    ResultVo<List<WmNewsVo>> wmNewsList(@RequestBody WmNewsDtoSave wmNewsDtoSave);

    /**
     * 远程调用更新文章
     * @param wmNews 文章对象
     * @return 。返回是否更新成功
     */
    @PutMapping("/api/admin/update")
    ResultVo updateWmNews(@RequestBody WmNews wmNews);
}
